<%--
  Created by IntelliJ IDEA.
  User: GiantM
  Date: 2018/3/12
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>零件搜索</title>
    <base href="<%= request.getContextPath()%>/">
    <link href="bootstrap/dist/css/bootstrap.css" rel="stylesheet">
    <style>
        .bigss{
            width: 1200px;
            height: 800px;
        }
        .themes{
            width:1200px;
            height: 50px;
        }
        .searchs{
            width:800px;
            height: 50px;
            margin-left: 250px;
        }
        .mid{
            width:1200px;
            height: 600px;
            margin-top: 10px;
        }
        .tiaojian{
            width:1200px;
            height: 40px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="bigss">
        <div class="themes">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <h1>零件搜索</h1>
                </div>
            </div>
        </div>
        <div class="searchs">
            <form class="form-inline" method="post" action="carparts/keyword/1">
                <input type="text" size="50"  name="ci" class="form-control" placeholder="请输入配件名称" id="ci"/>
                <input type="submit" value="搜索一下" id="tijiao" class="btn btn-info">
            </form>
        </div>
        <div class="tiaojian">
            <ul class="nav nav-tabs">
                <li role="presentation" class="active" style="padding-top: 10px">综合排序</li>
                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                        配件数量 <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li role="presentation" id="prices"><a href="carparts/searchNumGao/1" >配件数量从高到低</a></li>
                        <li role="presentation"><a href="carparts/searchNumDi/1">配件数量从低到高</a></li>
                    </ul>
                </li>
                <li role="presentation" class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                        价格 <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li role="presentation"><a href="carparts/searchPriceGao/1">采购价格从高到低</a></li>
                        <li role="presentation"><a href="carparts/searchPriceDi/1">采购价格从低到高</a></li>
                    </ul>
                </li>
            </ul>
        </div>
        <div class="mid">
            <table class="table table-hover" >
                <tr>
                    <th>编号</th>
                    <th>图片</th>
                    <th>配件名称</th>
                    <th>配件数量</th>
                    <th>供应商</th>
                    <th>采购单价</th>
                    <th>配件类型</th>
                </tr>
                <c:forEach items="${parts}" var="parts">
                    <tr>
                        <td>${parts.pieceId}</td>
                        <td>
                            <img src="show/${parts.piecePic}" width="50px">
                        </td>
                        <td>${parts.pieceEname}</td>
                        <td class="num">${parts.pieceNum}</td>
                        <td>${parts.pieceSupply}</td>
                        <td>${parts.priceCai}</td>
                        <td>${parts.pieceName}</td>
                    </tr>
                </c:forEach>
            </table>
            <div class="row">
                <div class=""col-md-8">
                当前<span class="badge">${p.pageNum}</span>页数，共<span class="badge">${p.pages}</span>页，总<span class="badge">${p.total}</span>条记录
            </div>
            <div class="col-md-6 col-md-offset-3">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <li ><a href="carparts/search/1">首页</a></li>
                        <c:if test="${p.hasPreviousPage}">
                            <li>
                                <a href="carparts/search/${p.pageNum-1}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:if>

                        <c:forEach items="${p.navigatepageNums}" var="page_num">
                            <c:if test="${page_num == p.pageNum}">
                                <li class="active"><a href="carparts/search/${page_num}">${page_num}</a></li>
                            </c:if>
                            <c:if test="${page_num != p.pageNum}">
                                <li ><a href="carparts/search/${page_num}">${page_num}</a></li>
                            </c:if>

                        </c:forEach>

                        <c:if test="${p.hasNextPage}">
                            <li>
                                <a href="carparts/search/${p.pageNum+1}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:if>

                        <li ><a href="carparts/search/${p.pages}">末页</a></li>
                    </ul>
                </nav>
            </div>
        </div>

        </div>
    </div>
</div>
</body>
</html>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="bootstrap/dist/js/bootstrap.js"></script>
<%--<script>
    $(function () {
        $("#tijiao").click(function () {
            var ci = $(this).parent().find("#ci").val();
            $.post("carparts/keyword/1",{ci:ci},function(data){
                location.href="carparts/keywordll/1/"+ci;
            })
        })
    })
</script>--%>
